(C) 1996 AROS - The Amiga Replacement OS


NAME
APTR Allocate()
SYNOPSIS
struct MemHeader * freeList
ULONG byteSize

LOCATION
In SysBase at offset 31
FUNCTION
Allocate memory out of a private region handled by the MemHeader structure.

INPUTS
freeList
Pointer to the MemHeader structure which holds the memory
byteSize
Number of bytes you want to get
RESULT
A pointer to the number of bytes you wanted or NULL if the memory couldn't be allocated

NOTES
The memory is aligned to sizeof(struct MemChunk). All requests are rounded up to a multiple of that size.

EXAMPLE
#define POOLSIZE 4096
\* Get a MemHeader structure and some private memory *\
mh=(struct MemHeader *)
    AllocMem(sizeof(struct MemHeader)+POOLSIZE,MEMF_ANY);
if(mh!=NULL)
{
    \* Build a private pool *\
    mh->mh_First=(struct MemChunk *)(mh+1);
    mh->mh_First->mc_Next=NULL;
    mh->mh_First->mc_Bytes=POOLSIZE;
    mh->mh_Free=POOLSIZE;
    {
	\* Use the pool *\
	UBYTE *mem1,*mem2;
	mem1=Allocate(mh,1000);
	mem2=Allocate(mh,2000);
	\* Do something with memory... *\
    }
    \* Free everything at once *\
    FreeMem(mh,sizeof(struct MemHeader)+POOLSIZE);
}

BUGS
SEE ALSO
Deallocate()
INTERNALS
HISTORY
12.05.1997 aros
Fixed all headers
01.01.1997 ldp
Committed Amiga native (support) code

Changed clib to proto

10.12.1996 aros
Moved all #include's in the first column so makedepend can see it.
24.10.1996 aros
Use the official AROS macros over the __AROS versions.
19.10.1996 aros
Include <aros/machine.h> instead of machine.h
13.09.1996 digulla
Use IPTR
13.08.1996 digulla
Replaced __AROS_LA by __AROS_LHA Replaced some __AROS_LH*I by __AROS_LH* Sorted and added includes
01.08.1996 digulla
Added standard header for all files
01.08.1996 digulla
Added copyright notics and made headers conform
28.07.1996 digulla
Initial revision
28.07.1996 digulla
First CVS version of AROS